package com.example.mental.controller;

import com.example.mental.service.ArticleService;
import com.example.mental.vo.ArticleVO;
import com.example.mental.vo.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/articles")
public class ArticleController {

    private final ArticleService articleService;

    public ArticleController(ArticleService articleService) {
        this.articleService = articleService;
    }

    @GetMapping("/latest")
    public Result<List<ArticleVO>> getLatestArticles() {
        return Result.success(articleService.getLatestArticles(2));
    }
} 